import { ajax } from '../http.js';
import { ajaxSync } from '../httpSync.js';

const discernCardUrl = '/authc/user_qualification/v2/discern_card'; // 识别身份证
const discernCharterUrl = '/authc/user_qualification/v2/discern_charter'; // 识别营业执照
const logoutUrl = '/authc/login_out'; // 登出
const getWxConfigInfoUrl = '/weixin/wechat_share';

const getWxConfigInfoSyncApi = (data, success, fail) => {
  return ajaxSync({
    url: getWxConfigInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getWxConfigInfoApi = (data, success, fail) => {
  ajax({
    url: getWxConfigInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const logoutApi = (data, success, fail) => {
  ajax({
    url: logoutUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const discernCardSyncApi = (data, success, fail) => {
  return ajaxSync({
    url: discernCardUrl,
    data: data
  });
};

const discernCardApi = (data, success, fail) => {
  ajax({
    url: discernCardUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const discernCharterSyncApi = (data, success, fail) => {
  return ajaxSync({
    url: discernCharterUrl,
    data: data
  });
};

const discernCharterApi = (data, success, fail) => {
  ajax({
    url: discernCharterUrl,
    data: data,
    success: success,
    fail: fail
  });
};

export {
  discernCardSyncApi,
  discernCharterSyncApi,
  discernCardApi,
  discernCharterApi,
  logoutApi,
  getWxConfigInfoApi,
  getWxConfigInfoSyncApi
}